The present invention, in some embodiments thereof, relates to a method to generate a source code that is a subset of an original source code and, more specifically, but not exclusively, to identifying dependencies between paths in a source code by applying control and data dependency methodologies.
There is great demand for applications that change their behavior based on information received from users or other runtime inputs. It is sometimes desirable to achieve changes in application behavior by choosing a subset of the application functionality, and excluding the rest of the application. For example, in order to simplify a user interface it is sometimes desirable to provide a subset of all functionality implemented in a program. Mobile applications in particular may offer multiple options that may be hidden from the user to simplify the user interface.
When attempting to reduce a software program by skipping undesired functionality, a number of technical challenges are encountered. The reduced program may include data that depends on excluded code for definition. Reducing the program in this case would result in unpredictable program behavior due to the broken data dependency.
Another problem is managing control flow. If the program receives input from a user during run time, and the user input determines the control flow of the program, it is difficult to accurately and consistently predict run time control flow. In addition, changes in control flow may change or add data dependencies.
While there exist automatic tools that track data and control dependencies, these tools target code that has a single point of entry and exit. The existing tools are not effective with programs where control flow is dynamically determined at run time. Currently analysis of control flow and data dependencies for programs with dynamic run time control flow are performed manually without the aid of software engineering methodology or automated tools.